package com.sanchunhui.psc.data.respository

import com.sanchunhui.psc.data.api.ProjectTeamApi
import com.sanchunhui.psc.data.api.TeamMemberApi
import com.sanchunhui.psc.data.net.RetrofitFactory
import com.sanchunhui.psc.data.protocol.BaseResp
import com.sanchunhui.psc.data.protocol.ResponseInfo
import com.sanchunhui.psc.data.protocol.TeamStatusReq
import com.sanchunhui.psc.data.protocol.TokenReq
import rx.Observable
import javax.inject.Inject

/**
 * @Author zyx
 * @Date 2021/7/21-14:13
 * @Dscribe
 */
class TeamMemberRepository @Inject constructor() {
    /*
         获取登录用户role=1分组下所有成员
     */
    fun getMyTeamMember(token: String): Observable<ResponseInfo> {
        return RetrofitFactory.instance.create(TeamMemberApi::class.java).getMyTeamMember(TokenReq(token))
    }

    /*
        获取所在或指定分组信息
     */
    fun getMyTeamInfo(token: String) : Observable<ResponseInfo> {
        return RetrofitFactory.instance.create(TeamMemberApi::class.java).getMyTeamInfo(TokenReq((token)))
    }

    /*
        更改分组状态
     */
    fun changeTeamStatus(teamId:Int, token: String, status:String) : Observable<ResponseInfo> {
        return RetrofitFactory.instance.create(TeamMemberApi::class.java).changeTeamStatus(teamId,
            TeamStatusReq(token, status)
        )
    }

}